﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Threading;

namespace SnakeGame_Roman
{
    class Program
    {

        static void Main(string[] args)

        {
            

            StartGame();
            
           
        }






        private static void StartGame()
        {
            MainManu mainManu = new MainManu();
            Console.WriteLine("Настал твой час, герой!");
            Console.WriteLine("Готов ли ты пройти испытание?");
            if (mainManu.StartMenuChoise() == 1)
            {
                Console.Clear();
                try
                {

                    int lenghtOfSnake = 4;
                    int gameFieldLenght = 40;
                    int gameFieldWidth = 20;

                    Random randomPieseOfFood = new Random();
                    GameEngine gameEngine = new GameEngine();
                    GameField gameField = new GameField(gameFieldLenght, gameFieldWidth);
                    Snake newSnake = new Snake(gameField.centreX, gameField.centreY, lenghtOfSnake);
                    Food newFood = new Food(randomPieseOfFood.Next(1, gameFieldLenght - 1), randomPieseOfFood.Next(1, gameFieldWidth - 1));




                    gameEngine.Start(newSnake, newFood, gameField);

                }
                catch
                {
                    Console.WriteLine("GAME OVER");
                }
                Console.ReadLine();


            }

        }
    }
}
